﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Data;
using NLBS.Framework;
using NLBS.Entity;
using NLBS.Data.Business;

namespace NLBS.Views.Admin
{
    public class ExtensionLinkPresenter : Presenter<IFirstContentView, IAction<ExtensionLink>>
    {

        public override void OnActionLoaded()
        {
            this.Action.DataInsert += new EventHandler(Action_DataInsert);
            this.Action.DataUpdate += new EventHandler(Action_DataUpdate);
            this.Action.DataDelete += new EventHandler(Action_DataDelete);
            this.Action.DataSelectSingle += new EventHandler(Action_DataSelectSingle);
            base.OnActionLoaded();
        }

        void Action_DataSelectSingle(object sender, EventArgs e)
        {
            this.Action.Entity = ExtensionLinkData.GetExtensionLinkByID(this.Action.keyID);
        }

        void Action_DataDelete(object sender, EventArgs e)
        {
            ExtensionLinkData.DeleteExtensionLink(this.Action.keyID);
        }

        void Action_DataUpdate(object sender, EventArgs e)
        {
            ExtensionLinkData.UpdateExtensionLink(this.Action.Entity);
        }

        void Action_DataInsert(object sender, EventArgs e)
        {
            //0 后台链接 1.侧栏链接 2.顶部
            ExtensionLinkData.InsertExtensionLink(this.Action.Entity);
        }
    }
}
